"use strict";

var handleImgBase64Data = require("../utils/ImgBase64Handler");
var adapter;
if (window.dsBridge) {
    adapter = function adapter(request, responseCallBack) {
        dsBridge.call("onAjaxRequest", request, function (responseData) {
            responseData = JSON.parse(responseData);
            if (request.responseType === "stream") {
                handleImgBase64Data(responseData);
            }
            responseCallBack(responseData);
        });
    };
} else {
    console.error("dsBridge is not exist!");
}

module.exports = adapter;